function [residual, g1, g2] = twosb_v10b_mobileKNoFItfpNoMe_static(y, x, params)
%
% Status : Computes static model for Dynare
%
% Warning : this file is generated automatically by Dynare
%           from model file (.mod)

residual = zeros( 162, 1);

%
% Model equations
%

crho__ = 1/(params(40)-1);
T3 = (-1);
T29 = params(83)^(-crho__);
T31 = params(84)^(-crho__);
T33 = (T29+T31)^T3;
T48 = 1/(1-params(8));
T52 = exp((-T48)*params(87));
T149 = params(7)/(1-params(8));
T152 = exp(params(86)+params(87)*T149);
T164 = (exp(2*(params(86)+params(87)*T149))+params(85)*params(16)^2)/((T152-params(85)*params(16))*(T152-params(16)));
T185 = T149*(params(85)*params(16)*T152*params(30)-params(16)*T152)/((T152-params(85)*params(16))*(T152-params(16)));
T203 = T48*y(27);
T309 = params(85)/(1+params(85));
T325 = (1-params(85)*params(18))*(1-params(18))/((1+params(85))*params(18)*(1+params(23)*(1+1/params(45))));
T334 = params(17)/(1+params(85));
T339 = (1+params(85)*params(17))/(1+params(85));
T403 = 1/(params(68)+(1-params(14))*params(101));
T421 = 1/(params(68)+(1-params(13))*params(102));
T443 = y(13)+T203*params(12)*exp(params(87)*2/(1-params(8)))-T203*params(12)*params(85)*exp(params(87)*2/(1-params(8)))-y(30);
T941 = (-(T48*params(12)*exp(params(87)*2/(1-params(8)))-T48*params(12)*params(85)*exp(params(87)*2/(1-params(8)))));
lhs =y(20);
rhs =params(88)*(params(8)*y(5)+(1-params(8))*y(1)+y(35)+y(77));
residual(1)= lhs-rhs;
lhs =y(20);
rhs =T29*T33*y(18)+T31*T33*y(19);
residual(2)= lhs-rhs;
lhs =y(17)+params(68)*params(80)/params(75)*T52*y(10)+T52*params(68)*params(81)/params(75)*y(11);
rhs =params(88)*(y(77)+params(7)*y(4)+(1-params(7))*y(2)+y(34));
residual(3)= lhs-rhs;
lhs =y(8);
rhs =params(7)*y(12)+(1-params(7))*y(24)-y(34)-y(77);
residual(4)= lhs-rhs;
lhs =y(9);
rhs =params(8)*y(12)+(1-params(8))*y(24)-y(13)-y(35)-y(77);
residual(5)= lhs-rhs;
lhs =y(12)-y(24);
rhs =y(2)-y(4);
residual(6)= lhs-rhs;
lhs =y(12)-y(24);
rhs =y(1)-y(5);
residual(7)= lhs-rhs;
lhs =y(22)-y(52);
rhs =(y(22)-y(52))*params(85)/(1+params(85)*params(19))+(y(22)-y(52))*params(19)/(1+params(85)*params(19))+y(8)*(1-params(20))*(1-params(85)*params(20))/((1+params(85)*params(19))*params(20))+y(50);
residual(8)= lhs-rhs;
lhs =y(23)-y(52);
rhs =(y(23)-y(52))*params(85)/(1+params(85)*params(21))+(y(23)-y(52))*params(21)/(1+params(85)*params(21))+y(9)*(1-params(22))*(1-params(85)*params(22))/((1+params(85)*params(21))*params(22))+y(51);
residual(9)= lhs-rhs;
lhs =y(14);
rhs =y(17)*params(85)*params(16)*T152/((T152-params(85)*params(16))*(T152-params(16)))-y(17)*T164+y(17)*params(16)*T152/((T152-params(85)*params(16))*(T152-params(16)))+(params(85)*params(16)*T152*params(29)-params(16)*T152)/((T152-params(85)*params(16))*(T152-params(16)))*y(26)+y(28)+T185*y(27);
residual(10)= lhs-rhs;
lhs =y(14);
rhs =y(14)+y(25)-y(26)-params(7)*y(27)/(1-params(8))-y(22);
residual(11)= lhs-rhs;
lhs =y(15);
rhs =T52*params(85)*(1-params(13))*(y(15)-T203+y(54))+(1-T52*params(85)*(1-params(13)))*(y(54)+y(10)+y(12)+y(14)-T203);
residual(12)= lhs-rhs;
lhs =y(16);
rhs =T52*params(85)*(1-params(14))*(y(16)-T203+y(53))+(1-T52*params(85)*(1-params(14)))*(y(53)+y(11)+y(12)+y(14)-T203);
residual(13)= lhs-rhs;
lhs =y(12);
rhs =y(10)*params(9);
residual(14)= lhs-rhs;
lhs =y(12);
rhs =y(11)*params(10);
residual(15)= lhs-rhs;
lhs =y(14);
rhs =T203*params(12)*params(85)*exp(2*T48*params(87))+y(30)+y(15)-y(13)-T203*params(12)*exp(2*T48*params(87))-(1+crho__)*(T33*(T31*y(19)+T29*y(18))-y(18));
residual(16)= lhs-rhs;
lhs =y(14);
rhs =T203*params(12)*params(85)*exp(2*T48*params(87))+y(30)+y(16)-y(13)-T203*params(12)*exp(2*T48*params(87))-(1+crho__)*(T33*(T31*y(19)+T29*y(18))-y(19));
residual(17)= lhs-rhs;
lhs =y(5);
rhs =y(54)+y(10)+y(6)-T203;
residual(18)= lhs-rhs;
lhs =y(4);
rhs =y(53)+y(11)+y(7)-T203;
residual(19)= lhs-rhs;
lhs =params(81)*y(7)+params(81)*y(6);
rhs =T52*(1-params(14))*(params(81)*y(7)+params(81)*y(53)-y(27)*T48*params(81))+T52*(1-params(13))*(params(80)*y(6)+params(80)*y(54)-y(27)*params(80)*T48)+(params(80)+params(81)-params(81)*T52*(1-params(14))-params(80)*T52*(1-params(13)))*(y(20)+y(30));
residual(20)= lhs-rhs;
lhs =y(24);
rhs =y(24)*1/(1+params(85))+y(24)*T309-T325*(y(14)+y(24)-params(23)*y(3)-y(28))+(y(22)-y(52))*T334-(y(22)-y(52))*T339+(y(22)-y(52))*T309+T334*(y(26)+T149*y(27))-y(26)*(1+params(85)*params(17)-params(85)*params(29))/(1+params(85))-y(27)*T149*(1+params(85)*params(17)-params(85)*params(30))/(1+params(85))+y(32);
residual(21)= lhs-rhs;
lhs =y(3);
rhs =y(2)*params(73)/params(46)+y(1)*params(74)/params(46);
residual(22)= lhs-rhs;
lhs =y(21);
rhs =y(17)*params(75)/params(82)+params(69)*params(76)/params(82)*(y(20)+y(13))+y(29);
residual(23)= lhs-rhs;
lhs =y(25);
rhs =y(22)*params(25)*(1-params(28))+y(25)*params(28)+y(31);
residual(24)= lhs-rhs;
residual(25) = y(23)-y(22);
lhs =y(57);
rhs =y(26)+y(53)+T403*(params(68)*(y(11)+y(12))+(1-params(14))*params(101)*y(59))-y(59)-y(27)*(1-params(7))/(1-params(8));
residual(26)= lhs-rhs;
lhs =y(58);
rhs =y(26)+y(54)+T421*(params(68)*(y(10)+y(12))+(1-params(13))*params(102)*y(60))-y(60)-y(27)*(1-params(7))/(1-params(8));
residual(27)= lhs-rhs;
lhs =y(59);
rhs =(1+crho__)*(T33*(T31*y(19)+T29*y(18))-y(19))+T443;
residual(28)= lhs-rhs;
lhs =y(60);
rhs =(1+crho__)*(T33*(T31*y(19)+T29*y(18))-y(18))+T443;
residual(29)= lhs-rhs;
lhs =y(26);
rhs =params(29)*y(26)+x(1)+y(71)+y(89)+y(96);
residual(30)= lhs-rhs;
lhs =y(71);
rhs =x(27);
residual(31)= lhs-rhs;
lhs =y(72);
rhs =x(28);
residual(32)= lhs-rhs;
lhs =y(73);
rhs =x(29);
residual(33)= lhs-rhs;
lhs =y(34);
rhs =y(34)*params(36)+x(15)+y(99)+y(106);
residual(34)= lhs-rhs;
lhs =y(81);
rhs =x(36);
residual(35)= lhs-rhs;
lhs =y(82);
rhs =x(37);
residual(36)= lhs-rhs;
lhs =y(27);
rhs =params(30)*y(27)+x(2)+y(74)+y(109)+y(116);
residual(37)= lhs-rhs;
lhs =y(74);
rhs =x(30);
residual(38)= lhs-rhs;
lhs =y(75);
rhs =x(31);
residual(39)= lhs-rhs;
lhs =y(76);
rhs =x(32);
residual(40)= lhs-rhs;
lhs =y(35);
rhs =y(35)*params(37)+x(14)+y(119)+y(126);
residual(41)= lhs-rhs;
lhs =y(83);
rhs =x(38);
residual(42)= lhs-rhs;
lhs =y(84);
rhs =x(39);
residual(43)= lhs-rhs;
lhs =y(28);
rhs =y(28)*params(31)+x(3);
residual(44)= lhs-rhs;
lhs =y(29);
rhs =y(29)*params(32)+x(10);
residual(45)= lhs-rhs;
lhs =y(30);
rhs =y(30)*params(33)+x(13);
residual(46)= lhs-rhs;
lhs =y(31);
rhs =y(31)*params(34)+x(4);
residual(47)= lhs-rhs;
lhs =y(50);
rhs =y(50)*params(48)+y(48)-y(48)*params(6);
residual(48)= lhs-rhs;
lhs =y(48);
rhs =x(5);
residual(49)= lhs-rhs;
lhs =y(51);
rhs =y(51)*params(49)+y(49)-y(49)*params(5);
residual(50)= lhs-rhs;
lhs =y(49);
rhs =x(6);
residual(51)= lhs-rhs;
lhs =y(32);
rhs =y(32)*params(35)+y(33)-y(33)*params(4);
residual(52)= lhs-rhs;
lhs =y(33);
rhs =x(7);
residual(53)= lhs-rhs;
lhs =y(52);
rhs =y(52)*params(50)+x(16);
residual(54)= lhs-rhs;
lhs =y(55);
rhs =y(55)*params(54)+x(8);
residual(55)= lhs-rhs;
lhs =y(56);
rhs =y(56)*params(55)+x(9);
residual(56)= lhs-rhs;
lhs =y(53);
rhs =y(53)*params(38)+x(11)+y(61)+y(127)+y(129)+y(132)-y(139);
residual(57)= lhs-rhs;
lhs =y(61);
rhs =x(17);
residual(58)= lhs-rhs;
lhs =y(62);
rhs =x(18);
residual(59)= lhs-rhs;
lhs =y(63);
rhs =x(19);
residual(60)= lhs-rhs;
lhs =y(64);
rhs =x(20);
residual(61)= lhs-rhs;
lhs =y(65);
rhs =x(21);
residual(62)= lhs-rhs;
lhs =y(54);
rhs =y(54)*params(39)+x(12)+y(66)+y(140)+y(142)+y(145)+y(152);
residual(63)= lhs-rhs;
lhs =y(66);
rhs =x(22);
residual(64)= lhs-rhs;
lhs =y(67);
rhs =x(23);
residual(65)= lhs-rhs;
lhs =y(68);
rhs =x(24);
residual(66)= lhs-rhs;
lhs =y(69);
rhs =x(25);
residual(67)= lhs-rhs;
lhs =y(70);
rhs =x(26);
residual(68)= lhs-rhs;
lhs =y(77);
rhs =y(77)*params(64)+x(33)+y(155)+y(162);
residual(69)= lhs-rhs;
lhs =y(78);
rhs =x(34);
residual(70)= lhs-rhs;
lhs =y(79);
rhs =x(35);
residual(71)= lhs-rhs;
lhs =y(85);
rhs =y(85)*params(65)+x(40);
residual(72)= lhs-rhs;
lhs =y(86);
rhs =y(86)*params(52)+x(42);
residual(73)= lhs-rhs;
lhs =y(36);
rhs =y(26)+T149*y(27);
residual(74)= lhs-rhs;
lhs =y(37);
rhs =y(26)+T149*y(27);
residual(75)= lhs-rhs;
lhs =y(38);
rhs =T203;
residual(76)= lhs-rhs;
lhs =y(39);
rhs =y(26)+y(27)*(params(7)-1)/(1-params(8));
residual(77)= lhs-rhs;
lhs =y(40);
rhs =y(26)+T149*y(27);
residual(78)= lhs-rhs;
lhs =y(43);
rhs =y(22);
residual(79)= lhs-rhs;
lhs =y(44);
rhs =y(23);
residual(80)= lhs-rhs;
lhs =y(42);
rhs =y(25);
residual(81)= lhs-rhs;
lhs =y(41);
rhs =y(3)+log(params(46));
residual(82)= lhs-rhs;
lhs =y(47);
rhs =y(25)-y(22);
residual(83)= lhs-rhs;
lhs =y(46);
rhs =exp(y(58))*exp(y(22))-exp(y(42));
residual(84)= lhs-rhs;
lhs =y(45);
rhs =exp(y(22))*exp(y(57))-exp(y(42));
residual(85)= lhs-rhs;
lhs =y(80);
rhs =y(85)+y(26)*(1-params(66))+y(27)*params(66);
residual(86)= lhs-rhs;
lhs =y(87);
rhs =y(72);
residual(87)= lhs-rhs;
lhs =y(88);
rhs =y(87);
residual(88)= lhs-rhs;
lhs =y(89);
rhs =y(88);
residual(89)= lhs-rhs;
lhs =y(90);
rhs =y(73);
residual(90)= lhs-rhs;
lhs =y(91);
rhs =y(90);
residual(91)= lhs-rhs;
lhs =y(92);
rhs =y(91);
residual(92)= lhs-rhs;
lhs =y(93);
rhs =y(92);
residual(93)= lhs-rhs;
lhs =y(94);
rhs =y(93);
residual(94)= lhs-rhs;
lhs =y(95);
rhs =y(94);
residual(95)= lhs-rhs;
lhs =y(96);
rhs =y(95);
residual(96)= lhs-rhs;
lhs =y(97);
rhs =y(81);
residual(97)= lhs-rhs;
lhs =y(98);
rhs =y(97);
residual(98)= lhs-rhs;
lhs =y(99);
rhs =y(98);
residual(99)= lhs-rhs;
lhs =y(100);
rhs =y(82);
residual(100)= lhs-rhs;
lhs =y(101);
rhs =y(100);
residual(101)= lhs-rhs;
lhs =y(102);
rhs =y(101);
residual(102)= lhs-rhs;
lhs =y(103);
rhs =y(102);
residual(103)= lhs-rhs;
lhs =y(104);
rhs =y(103);
residual(104)= lhs-rhs;
lhs =y(105);
rhs =y(104);
residual(105)= lhs-rhs;
lhs =y(106);
rhs =y(105);
residual(106)= lhs-rhs;
lhs =y(107);
rhs =y(75);
residual(107)= lhs-rhs;
lhs =y(108);
rhs =y(107);
residual(108)= lhs-rhs;
lhs =y(109);
rhs =y(108);
residual(109)= lhs-rhs;
lhs =y(110);
rhs =y(76);
residual(110)= lhs-rhs;
lhs =y(111);
rhs =y(110);
residual(111)= lhs-rhs;
lhs =y(112);
rhs =y(111);
residual(112)= lhs-rhs;
lhs =y(113);
rhs =y(112);
residual(113)= lhs-rhs;
lhs =y(114);
rhs =y(113);
residual(114)= lhs-rhs;
lhs =y(115);
rhs =y(114);
residual(115)= lhs-rhs;
lhs =y(116);
rhs =y(115);
residual(116)= lhs-rhs;
lhs =y(117);
rhs =y(83);
residual(117)= lhs-rhs;
lhs =y(118);
rhs =y(117);
residual(118)= lhs-rhs;
lhs =y(119);
rhs =y(118);
residual(119)= lhs-rhs;
lhs =y(120);
rhs =y(84);
residual(120)= lhs-rhs;
lhs =y(121);
rhs =y(120);
residual(121)= lhs-rhs;
lhs =y(122);
rhs =y(121);
residual(122)= lhs-rhs;
lhs =y(123);
rhs =y(122);
residual(123)= lhs-rhs;
lhs =y(124);
rhs =y(123);
residual(124)= lhs-rhs;
lhs =y(125);
rhs =y(124);
residual(125)= lhs-rhs;
lhs =y(126);
rhs =y(125);
residual(126)= lhs-rhs;
lhs =y(127);
rhs =y(62);
residual(127)= lhs-rhs;
lhs =y(128);
rhs =y(63);
residual(128)= lhs-rhs;
lhs =y(129);
rhs =y(128);
residual(129)= lhs-rhs;
lhs =y(130);
rhs =y(64);
residual(130)= lhs-rhs;
lhs =y(131);
rhs =y(130);
residual(131)= lhs-rhs;
lhs =y(132);
rhs =y(131);
residual(132)= lhs-rhs;
lhs =y(133);
rhs =y(65);
residual(133)= lhs-rhs;
lhs =y(134);
rhs =y(133);
residual(134)= lhs-rhs;
lhs =y(135);
rhs =y(134);
residual(135)= lhs-rhs;
lhs =y(136);
rhs =y(135);
residual(136)= lhs-rhs;
lhs =y(137);
rhs =y(136);
residual(137)= lhs-rhs;
lhs =y(138);
rhs =y(137);
residual(138)= lhs-rhs;
lhs =y(139);
rhs =y(138);
residual(139)= lhs-rhs;
lhs =y(140);
rhs =y(67);
residual(140)= lhs-rhs;
lhs =y(141);
rhs =y(68);
residual(141)= lhs-rhs;
lhs =y(142);
rhs =y(141);
residual(142)= lhs-rhs;
lhs =y(143);
rhs =y(69);
residual(143)= lhs-rhs;
lhs =y(144);
rhs =y(143);
residual(144)= lhs-rhs;
lhs =y(145);
rhs =y(144);
residual(145)= lhs-rhs;
lhs =y(146);
rhs =y(70);
residual(146)= lhs-rhs;
lhs =y(147);
rhs =y(146);
residual(147)= lhs-rhs;
lhs =y(148);
rhs =y(147);
residual(148)= lhs-rhs;
lhs =y(149);
rhs =y(148);
residual(149)= lhs-rhs;
lhs =y(150);
rhs =y(149);
residual(150)= lhs-rhs;
lhs =y(151);
rhs =y(150);
residual(151)= lhs-rhs;
lhs =y(152);
rhs =y(151);
residual(152)= lhs-rhs;
lhs =y(153);
rhs =y(78);
residual(153)= lhs-rhs;
lhs =y(154);
rhs =y(153);
residual(154)= lhs-rhs;
lhs =y(155);
rhs =y(154);
residual(155)= lhs-rhs;
lhs =y(156);
rhs =y(79);
residual(156)= lhs-rhs;
lhs =y(157);
rhs =y(156);
residual(157)= lhs-rhs;
lhs =y(158);
rhs =y(157);
residual(158)= lhs-rhs;
lhs =y(159);
rhs =y(158);
residual(159)= lhs-rhs;
lhs =y(160);
rhs =y(159);
residual(160)= lhs-rhs;
lhs =y(161);
rhs =y(160);
residual(161)= lhs-rhs;
lhs =y(162);
rhs =y(161);
residual(162)= lhs-rhs;
if ~isreal(residual)
  residual = real(residual)+imag(residual).^2;
end
if nargout >= 2,
  g1 = zeros(162, 162);

  %
  % Jacobian matrix
  %

  g1(1,1)=(-(params(88)*(1-params(8))));
  g1(1,5)=(-(params(88)*params(8)));
  g1(1,20)=1;
  g1(1,35)=(-params(88));
  g1(1,77)=(-params(88));
  g1(2,18)=(-(T29*T33));
  g1(2,19)=(-(T31*T33));
  g1(2,20)=1;
  g1(3,2)=(-(params(88)*(1-params(7))));
  g1(3,4)=(-(params(88)*params(7)));
  g1(3,10)=params(68)*params(80)/params(75)*T52;
  g1(3,11)=T52*params(68)*params(81)/params(75);
  g1(3,17)=1;
  g1(3,34)=(-params(88));
  g1(3,77)=(-params(88));
  g1(4,8)=1;
  g1(4,12)=(-params(7));
  g1(4,24)=(-(1-params(7)));
  g1(4,34)=1;
  g1(4,77)=1;
  g1(5,9)=1;
  g1(5,12)=(-params(8));
  g1(5,13)=1;
  g1(5,24)=(-(1-params(8)));
  g1(5,35)=1;
  g1(5,77)=1;
  g1(6,2)=T3;
  g1(6,4)=1;
  g1(6,12)=1;
  g1(6,24)=T3;
  g1(7,1)=T3;
  g1(7,5)=1;
  g1(7,12)=1;
  g1(7,24)=T3;
  g1(8,8)=(-((1-params(20))*(1-params(85)*params(20))/((1+params(85)*params(19))*params(20))));
  g1(8,22)=1-(params(85)/(1+params(85)*params(19))+params(19)/(1+params(85)*params(19)));
  g1(8,50)=T3;
  g1(8,52)=T3-((-(params(85)/(1+params(85)*params(19))))-params(19)/(1+params(85)*params(19)));
  g1(9,9)=(-((1-params(22))*(1-params(85)*params(22))/((1+params(85)*params(21))*params(22))));
  g1(9,23)=1-(params(85)/(1+params(85)*params(21))+params(21)/(1+params(85)*params(21)));
  g1(9,51)=T3;
  g1(9,52)=T3-((-(params(85)/(1+params(85)*params(21))))-params(21)/(1+params(85)*params(21)));
  g1(10,14)=1;
  g1(10,17)=(-(params(16)*T152/((T152-params(85)*params(16))*(T152-params(16)))+params(85)*params(16)*T152/((T152-params(85)*params(16))*(T152-params(16)))-T164));
  g1(10,26)=(-((params(85)*params(16)*T152*params(29)-params(16)*T152)/((T152-params(85)*params(16))*(T152-params(16)))));
  g1(10,27)=(-T185);
  g1(10,28)=T3;
  g1(11,22)=1;
  g1(11,25)=T3;
  g1(11,26)=1;
  g1(11,27)=T149;
  g1(12,10)=(-(1-T52*params(85)*(1-params(13))));
  g1(12,12)=(-(1-T52*params(85)*(1-params(13))));
  g1(12,14)=(-(1-T52*params(85)*(1-params(13))));
  g1(12,15)=1-T52*params(85)*(1-params(13));
  g1(12,27)=(-((-T48)*T52*params(85)*(1-params(13))+(-T48)*(1-T52*params(85)*(1-params(13)))));
  g1(12,54)=(-(T52*params(85)*(1-params(13))+1-T52*params(85)*(1-params(13))));
  g1(13,11)=(-(1-T52*params(85)*(1-params(14))));
  g1(13,12)=(-(1-T52*params(85)*(1-params(14))));
  g1(13,14)=(-(1-T52*params(85)*(1-params(14))));
  g1(13,16)=1-T52*params(85)*(1-params(14));
  g1(13,27)=(-((-T48)*T52*params(85)*(1-params(14))+(-T48)*(1-T52*params(85)*(1-params(14)))));
  g1(13,53)=(-(T52*params(85)*(1-params(14))+1-T52*params(85)*(1-params(14))));
  g1(14,10)=(-params(9));
  g1(14,12)=1;
  g1(15,11)=(-params(10));
  g1(15,12)=1;
  g1(16,13)=1;
  g1(16,14)=1;
  g1(16,15)=T3;
  g1(16,18)=(1+crho__)*(T29*T33-1);
  g1(16,19)=T31*T33*(1+crho__);
  g1(16,27)=(-(T48*params(12)*params(85)*exp(2*T48*params(87))-T48*params(12)*exp(2*T48*params(87))));
  g1(16,30)=T3;
  g1(17,13)=1;
  g1(17,14)=1;
  g1(17,16)=T3;
  g1(17,18)=T29*T33*(1+crho__);
  g1(17,19)=(1+crho__)*(T31*T33-1);
  g1(17,27)=(-(T48*params(12)*params(85)*exp(2*T48*params(87))-T48*params(12)*exp(2*T48*params(87))));
  g1(17,30)=T3;
  g1(18,5)=1;
  g1(18,6)=T3;
  g1(18,10)=T3;
  g1(18,27)=T48;
  g1(18,54)=T3;
  g1(19,4)=1;
  g1(19,7)=T3;
  g1(19,11)=T3;
  g1(19,27)=T48;
  g1(19,53)=T3;
  g1(20,6)=params(81)-params(80)*T52*(1-params(13));
  g1(20,7)=params(81)-params(81)*T52*(1-params(14));
  g1(20,20)=(-(params(80)+params(81)-params(81)*T52*(1-params(14))-params(80)*T52*(1-params(13))));
  g1(20,27)=(-(T52*(1-params(14))*(-(T48*params(81)))+T52*(1-params(13))*(-(params(80)*T48))));
  g1(20,30)=(-(params(80)+params(81)-params(81)*T52*(1-params(14))-params(80)*T52*(1-params(13))));
  g1(20,53)=(-(params(81)*T52*(1-params(14))));
  g1(20,54)=(-(params(80)*T52*(1-params(13))));
  g1(21,3)=T325*(-params(23));
  g1(21,14)=T325;
  g1(21,22)=(-(T309+T334-T339));
  g1(21,24)=1-(1/(1+params(85))+T309-T325);
  g1(21,26)=(-(T334-(1+params(85)*params(17)-params(85)*params(29))/(1+params(85))));
  g1(21,27)=(-(T149*T334-T149*(1+params(85)*params(17)-params(85)*params(30))/(1+params(85))));
  g1(21,28)=(-T325);
  g1(21,32)=T3;
  g1(21,52)=(-((-T334)-(-T339)-T309));
  g1(22,1)=(-(params(74)/params(46)));
  g1(22,2)=(-(params(73)/params(46)));
  g1(22,3)=1;
  g1(23,13)=(-(params(69)*params(76)/params(82)));
  g1(23,17)=(-(params(75)/params(82)));
  g1(23,20)=(-(params(69)*params(76)/params(82)));
  g1(23,21)=1;
  g1(23,29)=T3;
  g1(24,22)=(-(params(25)*(1-params(28))));
  g1(24,25)=1-params(28);
  g1(24,31)=T3;
  g1(25,22)=T3;
  g1(25,23)=1;
  g1(26,11)=(-(params(68)*T403));
  g1(26,12)=(-(params(68)*T403));
  g1(26,26)=T3;
  g1(26,27)=(1-params(7))/(1-params(8));
  g1(26,53)=T3;
  g1(26,57)=1;
  g1(26,59)=(-((1-params(14))*params(101)*T403-1));
  g1(27,10)=(-(params(68)*T421));
  g1(27,12)=(-(params(68)*T421));
  g1(27,26)=T3;
  g1(27,27)=(1-params(7))/(1-params(8));
  g1(27,54)=T3;
  g1(27,58)=1;
  g1(27,60)=(-((1-params(13))*params(102)*T421-1));
  g1(28,13)=T3;
  g1(28,18)=(-(T29*T33*(1+crho__)));
  g1(28,19)=(-((1+crho__)*(T31*T33-1)));
  g1(28,27)=T941;
  g1(28,30)=1;
  g1(28,59)=1;
  g1(29,13)=T3;
  g1(29,18)=(-((1+crho__)*(T29*T33-1)));
  g1(29,19)=(-(T31*T33*(1+crho__)));
  g1(29,27)=T941;
  g1(29,30)=1;
  g1(29,60)=1;
  g1(30,26)=1-params(29);
  g1(30,71)=T3;
  g1(30,89)=T3;
  g1(30,96)=T3;
  g1(31,71)=1;
  g1(32,72)=1;
  g1(33,73)=1;
  g1(34,34)=1-params(36);
  g1(34,99)=T3;
  g1(34,106)=T3;
  g1(35,81)=1;
  g1(36,82)=1;
  g1(37,27)=1-params(30);
  g1(37,74)=T3;
  g1(37,109)=T3;
  g1(37,116)=T3;
  g1(38,74)=1;
  g1(39,75)=1;
  g1(40,76)=1;
  g1(41,35)=1-params(37);
  g1(41,119)=T3;
  g1(41,126)=T3;
  g1(42,83)=1;
  g1(43,84)=1;
  g1(44,28)=1-params(31);
  g1(45,29)=1-params(32);
  g1(46,30)=1-params(33);
  g1(47,31)=1-params(34);
  g1(48,48)=(-(1-params(6)));
  g1(48,50)=1-params(48);
  g1(49,48)=1;
  g1(50,49)=(-(1-params(5)));
  g1(50,51)=1-params(49);
  g1(51,49)=1;
  g1(52,32)=1-params(35);
  g1(52,33)=(-(1-params(4)));
  g1(53,33)=1;
  g1(54,52)=1-params(50);
  g1(55,55)=1-params(54);
  g1(56,56)=1-params(55);
  g1(57,53)=1-params(38);
  g1(57,61)=T3;
  g1(57,127)=T3;
  g1(57,129)=T3;
  g1(57,132)=T3;
  g1(57,139)=1;
  g1(58,61)=1;
  g1(59,62)=1;
  g1(60,63)=1;
  g1(61,64)=1;
  g1(62,65)=1;
  g1(63,54)=1-params(39);
  g1(63,66)=T3;
  g1(63,140)=T3;
  g1(63,142)=T3;
  g1(63,145)=T3;
  g1(63,152)=T3;
  g1(64,66)=1;
  g1(65,67)=1;
  g1(66,68)=1;
  g1(67,69)=1;
  g1(68,70)=1;
  g1(69,77)=1-params(64);
  g1(69,155)=T3;
  g1(69,162)=T3;
  g1(70,78)=1;
  g1(71,79)=1;
  g1(72,85)=1-params(65);
  g1(73,86)=1-params(52);
  g1(74,26)=T3;
  g1(74,27)=(-T149);
  g1(74,36)=1;
  g1(75,26)=T3;
  g1(75,27)=(-T149);
  g1(75,37)=1;
  g1(76,27)=(-T48);
  g1(76,38)=1;
  g1(77,26)=T3;
  g1(77,27)=(-((params(7)-1)/(1-params(8))));
  g1(77,39)=1;
  g1(78,26)=T3;
  g1(78,27)=(-T149);
  g1(78,40)=1;
  g1(79,22)=T3;
  g1(79,43)=1;
  g1(80,23)=T3;
  g1(80,44)=1;
  g1(81,25)=T3;
  g1(81,42)=1;
  g1(82,3)=T3;
  g1(82,41)=1;
  g1(83,22)=1;
  g1(83,25)=T3;
  g1(83,47)=1;
  g1(84,22)=(-(exp(y(58))*exp(y(22))));
  g1(84,42)=exp(y(42));
  g1(84,46)=1;
  g1(84,58)=(-(exp(y(58))*exp(y(22))));
  g1(85,22)=(-(exp(y(22))*exp(y(57))));
  g1(85,42)=exp(y(42));
  g1(85,45)=1;
  g1(85,57)=(-(exp(y(22))*exp(y(57))));
  g1(86,26)=(-(1-params(66)));
  g1(86,27)=(-params(66));
  g1(86,80)=1;
  g1(86,85)=T3;
  g1(87,72)=T3;
  g1(87,87)=1;
  g1(88,87)=T3;
  g1(88,88)=1;
  g1(89,88)=T3;
  g1(89,89)=1;
  g1(90,73)=T3;
  g1(90,90)=1;
  g1(91,90)=T3;
  g1(91,91)=1;
  g1(92,91)=T3;
  g1(92,92)=1;
  g1(93,92)=T3;
  g1(93,93)=1;
  g1(94,93)=T3;
  g1(94,94)=1;
  g1(95,94)=T3;
  g1(95,95)=1;
  g1(96,95)=T3;
  g1(96,96)=1;
  g1(97,81)=T3;
  g1(97,97)=1;
  g1(98,97)=T3;
  g1(98,98)=1;
  g1(99,98)=T3;
  g1(99,99)=1;
  g1(100,82)=T3;
  g1(100,100)=1;
  g1(101,100)=T3;
  g1(101,101)=1;
  g1(102,101)=T3;
  g1(102,102)=1;
  g1(103,102)=T3;
  g1(103,103)=1;
  g1(104,103)=T3;
  g1(104,104)=1;
  g1(105,104)=T3;
  g1(105,105)=1;
  g1(106,105)=T3;
  g1(106,106)=1;
  g1(107,75)=T3;
  g1(107,107)=1;
  g1(108,107)=T3;
  g1(108,108)=1;
  g1(109,108)=T3;
  g1(109,109)=1;
  g1(110,76)=T3;
  g1(110,110)=1;
  g1(111,110)=T3;
  g1(111,111)=1;
  g1(112,111)=T3;
  g1(112,112)=1;
  g1(113,112)=T3;
  g1(113,113)=1;
  g1(114,113)=T3;
  g1(114,114)=1;
  g1(115,114)=T3;
  g1(115,115)=1;
  g1(116,115)=T3;
  g1(116,116)=1;
  g1(117,83)=T3;
  g1(117,117)=1;
  g1(118,117)=T3;
  g1(118,118)=1;
  g1(119,118)=T3;
  g1(119,119)=1;
  g1(120,84)=T3;
  g1(120,120)=1;
  g1(121,120)=T3;
  g1(121,121)=1;
  g1(122,121)=T3;
  g1(122,122)=1;
  g1(123,122)=T3;
  g1(123,123)=1;
  g1(124,123)=T3;
  g1(124,124)=1;
  g1(125,124)=T3;
  g1(125,125)=1;
  g1(126,125)=T3;
  g1(126,126)=1;
  g1(127,62)=T3;
  g1(127,127)=1;
  g1(128,63)=T3;
  g1(128,128)=1;
  g1(129,128)=T3;
  g1(129,129)=1;
  g1(130,64)=T3;
  g1(130,130)=1;
  g1(131,130)=T3;
  g1(131,131)=1;
  g1(132,131)=T3;
  g1(132,132)=1;
  g1(133,65)=T3;
  g1(133,133)=1;
  g1(134,133)=T3;
  g1(134,134)=1;
  g1(135,134)=T3;
  g1(135,135)=1;
  g1(136,135)=T3;
  g1(136,136)=1;
  g1(137,136)=T3;
  g1(137,137)=1;
  g1(138,137)=T3;
  g1(138,138)=1;
  g1(139,138)=T3;
  g1(139,139)=1;
  g1(140,67)=T3;
  g1(140,140)=1;
  g1(141,68)=T3;
  g1(141,141)=1;
  g1(142,141)=T3;
  g1(142,142)=1;
  g1(143,69)=T3;
  g1(143,143)=1;
  g1(144,143)=T3;
  g1(144,144)=1;
  g1(145,144)=T3;
  g1(145,145)=1;
  g1(146,70)=T3;
  g1(146,146)=1;
  g1(147,146)=T3;
  g1(147,147)=1;
  g1(148,147)=T3;
  g1(148,148)=1;
  g1(149,148)=T3;
  g1(149,149)=1;
  g1(150,149)=T3;
  g1(150,150)=1;
  g1(151,150)=T3;
  g1(151,151)=1;
  g1(152,151)=T3;
  g1(152,152)=1;
  g1(153,78)=T3;
  g1(153,153)=1;
  g1(154,153)=T3;
  g1(154,154)=1;
  g1(155,154)=T3;
  g1(155,155)=1;
  g1(156,79)=T3;
  g1(156,156)=1;
  g1(157,156)=T3;
  g1(157,157)=1;
  g1(158,157)=T3;
  g1(158,158)=1;
  g1(159,158)=T3;
  g1(159,159)=1;
  g1(160,159)=T3;
  g1(160,160)=1;
  g1(161,160)=T3;
  g1(161,161)=1;
  g1(162,161)=T3;
  g1(162,162)=1;
  if ~isreal(g1)
    g1 = real(g1)+2*imag(g1);
  end
end
if nargout >= 3,
  %
  % Hessian matrix
  %

  g2 = sparse([],[],[],162,26244);
end
end
